home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1995 #5 & #6 / Amiga Plus CD - 1995 - No. 5 and 6.iso / pd / serien / purity / nr.37 / battclock / units / battclockplus.p < prev    next >
Text File  |  1994-09-17  |  2KB  |  108 lines

  1. { Unit:      BattClockPlus
  2.  
  3.   Version:   1.04 (1993-1994)
  4.  
  5.   Meaning:   read battclock: all battclock data (see BattclockLight)
  6.  
  7.   for:       KP2.12/OS2 or MaxonPASCAL3
  8.  
  9.   Copyright: FW, you must use authors name in Info or Doc
  10.  
  11.   Author:    PackMAN
  12.              c/o Falk Zühlsdorff
  13.              Lindenberg 66
  14.              D-98693 Ilmenau / Thuringia                              }
  15.  
  16. UNIT BattClockPlus;
  17.  
  18. INTERFACE
  19.  
  20. {$opt q}
  21. Uses UTILITY;
  22. {$ INCL 'resources/battclock.h'}
  23.  
  24. FUNCTION GetBattClock(dt:boolean):boolean;
  25.  
  26. VAR mday,month,year,
  27.     hour,min,sec:word;
  28.     wday,battclocktime,
  29.     battclockdate:string;
  30.  
  31. IMPLEMENTATION
  32.  
  33. FUNCTION GetBattClock;
  34. VAR current:p_ClockData;
  35. BEGIN
  36.  BattclockBase:=OpenResource(BATTCLOCKNAME);
  37.  IF (BattclockBase<>NIL) AND (UtilityBase<>NIL)
  38.   THEN
  39.    BEGIN
  40.     NEW(current);
  41.     Amiga2Date(ReadBattClock,current);
  42.     IF dt THEN
  43.       case current^.wday of
  44.        0: wday:='Sonntag ';
  45.        1: wday:='Montag ';
  46.        2: wday:='Dienstag ';
  47.        3: wday:='Mittwoch ';
  48.        4: wday:='Donnerstag ';
  49.        5: wday:='Freitag ';
  50.        6: wday:='Samstag ';
  51.       else;end
  52.      ELSE
  53.     case current^.wday of
  54.       0: wday:='Sunday ';
  55.       1: wday:='Monday ';
  56.       2: wday:='Tuesday ';
  57.       3: wday:='Wednesday ';
  58.       4: wday:='Thursday ';
  59.       5: wday:='Friday ';
  60.       6: wday:='Saturday ';
  61.     else;end;
  62.     battclockdate:='';
  63.     IF current^.mday<10
  64.       THEN battclockdate:=('0'+INTSTR(current^.mday)+'.')
  65.       ELSE battclockdate:=(INTSTR(current^.mday)+'.');
  66.     IF current^.month<10
  67.      THEN battclockdate:=(battclockdate+'0'+INTSTR(current^.month)+
  68.                           '.'+INTSTR(current^.year))
  69.      ELSE battclockdate:=(battclockdate+INTSTR(current^.month)+'.'+
  70.                           INTSTR(current^.year));
  71.  
  72.     mday:=current^.mday;
  73.     month:=current^.month;
  74.     year:=current^.year;
  75.     hour:=current^.hour;
  76.     min:=current^.min;
  77.     sec:=current^.sec;
  78.     battclocktime:='';
  79.     IF current^.hour<10
  80.      THEN battclocktime:=('0'+INTSTR(current^.hour)+':')
  81.      ELSE battclocktime:=(INTSTR(current^.hour)+':');
  82.     IF current^.min<10
  83.      THEN battclocktime:=(battclocktime+'0'+INTSTR(current^.min)+':')
  84.      ELSE battclocktime:=(battclocktime+INTSTR(current^.min)+':');
  85.     IF current^.sec<10
  86.      THEN battclocktime:=(battclocktime+'0'+INTSTR(current^.sec))
  87.      ELSE battclocktime:=(battclocktime+INTSTR(current^.sec));
  88.     GetBattclock:=true;
  89.    END
  90.   ELSE
  91.     GetBattclock:=false;
  92. END;
  93.  
  94. END.
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.